package com.athena.servlet;

import com.athena.pojo.Request;
import com.athena.pojo.Response;
import com.athena.utils.HttpProtocolUtil;
import java.io.IOException;

/**
 * @Author: xiaoxiang.zhang
 * @Description:
 * @Date: Create in 2:43 下午 2020/3/26
 */
public class Demo2Servlet extends HttpServlet {

  @Override
  public void doGet(Request request, Response response) {
    String content = "<h1>Demo2Servlet get</h1>";
    try {
      response.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }


  @Override
  public void doPost(Request request, Response response) {
    String content = "<h1>Demo2Servlet Post</h1>";
    try {
      response.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  @Override
  public void init() throws Exception {

  }

  @Override
  public void destory() throws Exception {

  }
}
